﻿// -----------------------------------------------------------------------
// <copyright file="FormsAuthenticationAdapter.cs" company="CompDJ">
//     Copyright (c) CompDJ. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

namespace CompDJ.Web.Abstractions
{
    using System;
    using System.Collections.Specialized;
    using System.Web;
    using System.Web.Configuration;
    using System.Web.Security;

    /// <summary>FormsAuthentication adapter.</summary>
    /// <remarks>By default, this class cannot be unit tested, as it is an 
    /// adapter for the real thing. Plus, there is no actual logic in here.</remarks>
    [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
    public partial class FormsAuthenticationAdapter : IFormsAuthentication
    {        
        /// <summary>Initializes a new instance of the FormsAuthenticationAdapter class.</summary>
        public FormsAuthenticationAdapter()
        {
        }

        public virtual string CookieDomain
        {
            get { return FormsAuthentication.CookieDomain; }
        }

        public virtual System.Web.HttpCookieMode CookieMode
        {
            get { return FormsAuthentication.CookieMode; }
        }

        public virtual bool CookiesSupported
        {
            get { return FormsAuthentication.CookiesSupported; }
        }

        public virtual string DefaultUrl
        {
            get { return FormsAuthentication.DefaultUrl; }
        }

        public virtual bool EnableCrossAppRedirects
        {
            get { return FormsAuthentication.EnableCrossAppRedirects; }
        }

        public virtual string FormsCookieName
        {
            get { return FormsAuthentication.FormsCookieName; }
        }

        public virtual string FormsCookiePath
        {
            get { return FormsAuthentication.FormsCookiePath; }
        }

        public virtual bool IsEnabled
        {
            get { return FormsAuthentication.IsEnabled; }
        }

        public virtual string LoginUrl
        {
            get { return FormsAuthentication.LoginUrl; }
        }

        public virtual bool RequireSSL
        {
            get { return FormsAuthentication.RequireSSL; }
        }

        public virtual bool SlidingExpiration
        {
            get { return FormsAuthentication.SlidingExpiration; }
        }

        public virtual TicketCompatibilityMode TicketCompatibilityMode
        {
            get { return FormsAuthentication.TicketCompatibilityMode; }
        }

        public virtual TimeSpan Timeout
        {
            get { return FormsAuthentication.Timeout; }
        }

        public virtual bool Authenticate(string name, string password)
        {
            return FormsAuthentication.Authenticate(name, password);
        }

        public virtual FormsAuthenticationTicket Decrypt(string encryptedTicket)
        {
            return FormsAuthentication.Decrypt(encryptedTicket);
        }

        public virtual void EnableFormsAuthentication(NameValueCollection configurationData)
        {
            FormsAuthentication.EnableFormsAuthentication(configurationData);
        }

        public virtual string Encrypt(FormsAuthenticationTicket ticket)
        {
            return FormsAuthentication.Encrypt(ticket);
        }

        public virtual HttpCookie GetAuthCookie(string userName, bool createPersistentCookie)
        {
            return FormsAuthentication.GetAuthCookie(userName, createPersistentCookie);
        }

        public virtual HttpCookie GetAuthCookie(string userName, bool createPersistentCookie, string strCookiePath)
        {
            return FormsAuthentication.GetAuthCookie(userName, createPersistentCookie, strCookiePath);
        }

        public virtual string GetRedirectUrl(string userName, bool createPersistentCookie)
        {
            return FormsAuthentication.GetRedirectUrl(userName, createPersistentCookie);
        }

        public virtual string HashPasswordForStoringInConfigFile(string password, string passwordFormat)
        {
            return FormsAuthentication.HashPasswordForStoringInConfigFile(password, passwordFormat);
        }

        public virtual void Initialize()
        {
            FormsAuthentication.Initialize();
        }

        public virtual void RedirectFromLoginPage(string userName, bool createPersistentCookie)
        {
            FormsAuthentication.RedirectFromLoginPage(userName, createPersistentCookie);
        }

        public virtual void RedirectFromLoginPage(string userName, bool createPersistentCookie, string strCookiePath)
        {
            FormsAuthentication.RedirectFromLoginPage(userName, createPersistentCookie, strCookiePath);
        }

        public virtual void RedirectToLoginPage()
        {
            FormsAuthentication.RedirectToLoginPage();
        }

        public virtual void RedirectToLoginPage(string extraQueryString)
        {
            FormsAuthentication.RedirectToLoginPage(extraQueryString);
        }

        public virtual FormsAuthenticationTicket RenewTicketIfOld(FormsAuthenticationTicket tOld)
        {
            return FormsAuthentication.RenewTicketIfOld(tOld);
        }

        public virtual void SetAuthCookie(string userName, bool createPersistentCookie)
        {
            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
        }

        public virtual void SetAuthCookie(string userName, bool createPersistentCookie, string strCookiePath)
        {
            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie, strCookiePath);
        }

        public virtual void SignOut()
        {
            FormsAuthentication.SignOut();
        }
    }
}
